package br.com.felix.easyclearcase.tasks;


/**
 * Base class for interface tasks.
 * Makes the appropriate state changes.
 * */
public abstract class InterfaceTask extends Task {


	/**
	 * InterfaceTask priority is HIGH.
	 * */
	@Override
	public TaskPriority getTaskPriority() {
		return TaskPriority.HIGH;
	}
	
	
	/**
	 * Calls the changeInterface method and make the appropriate status changes.
	 * */
	@Override
	public void run(){
		changeStatus(TaskStatus.IN_PROGRESS);
		try{
			changeInterface();
		}
		catch(RuntimeException e){
			changeStatus(TaskStatus.COMPLETE_FAIL);
		}
		changeStatus(TaskStatus.COMPLETE_SUCCESS);
	}
	
	/**
	 * Method called when the task in run.
	 * */
	public abstract void changeInterface();

}
